<template>
    <div>这是动态组件1
        <span style="color: red">{{ data }}</span>
        <br/>
        <el-button @click="emitEvent">定义一个事件给父组件监听</el-button>
    </div>
</template>

<script>
export default {
    props: {
        data: {
            type: String,
            default: "",
        },
    },
    created() { 
        console.log("子组件1的created")
    },
    methods: {
        emitEvent() { 
            this.$emit("custom-event")
        }
    }
};
</script>

<style>
</style>